package com.yc.myspringboot.task;

import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

public class TestThreadPoolTaskScheduler {
	
	public void m1() {
		ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
		scheduler.setThreadNamePrefix("yctest-");
		scheduler.setPoolSize(10);
		scheduler.initialize();
		
		scheduler.scheduleAtFixedRate(new Runnable() {
			
			@Override
			public void run() {
				System.out.println("-------1---start--");
				
				try {
					Thread.sleep(10000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println("-------1---end--");
				
			}
		}, 2000);
		
	}

	public static void main(String[] args) {
		TestThreadPoolTaskScheduler t = new TestThreadPoolTaskScheduler();
		t.m1();

	}

}
